package com.extension.company.view.my.localorder.localorderfragment;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.extension.company.admin.R;
import com.extension.company.model.entity.SameCityOrderAllBean;
import com.extension.company.common.mvc.BaseFragment;
import com.extension.company.view.my.localorder.adapter.LocalCityUnCommitmentAdapter;
import com.extension.company.view.my.onlineorder.MyCommitActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;


/**
 * 同城订单 --- 未评论 fragment
 */
public class LocalCityOrderUnCommitmentFragment extends BaseFragment {

	@BindView(R.id.commit_list)
	RecyclerView recyclerView;

	private Context context;
	private List<SameCityOrderAllBean> list = new ArrayList<>();
	private LocalCityUnCommitmentAdapter adapter;

	public static LocalCityOrderUnCommitmentFragment newInstance() {
		LocalCityOrderUnCommitmentFragment fragment = new LocalCityOrderUnCommitmentFragment();
		return fragment;
	}


	@Override
	public void init() {
		recyclerView.setLayoutManager(new GridLayoutManager(context, 1));
		adapter = new LocalCityUnCommitmentAdapter(context, list);
		recyclerView.setAdapter(adapter);

		adapter.setRCYOnclick(new LocalCityUnCommitmentAdapter.OnListFragmentInteractionListener() {
			@Override
			public void orderAgain() {

			}

			@Override
			public void commitImmeditately() {
				Intent intent = new Intent(context, MyCommitActivity.class);
				startActivity(intent);
			}
		});


	}

	@Override
	public int getMainLayout() {
		return R.layout.fragment_fragmentuncommitment_list;
	}


	@Override
	public void onAttach(Context context) {
		super.onAttach(context);
		this.context = context;
	}

}
